﻿using System;
using System.Collections;
using System.Collections.Generic;
using System.Data;
using System.Web.UI.WebControls;
using Telerik.Web.UI;
using KPIS.GERP.GFMS.APP.App_UI.Commons;
using KPIS.GERP.GFMS.IBLL;
using KPIS.GERP.GFMS.BLL;
using KPIS.GERP.GFMS.MODEL;
using KPIS.GERP.GFMS.DAL;


namespace KPIS.GERP.GFMS.APP.App_UI.Forms
{
    public partial class FIM_MoneyReturnsOpen : System.Web.UI.Page
    {

        Main main = new Main();
       IBLL_FIM_MoneyRequests mr = new B_FIM_MoneyRequests();
       //IBLL_FIM_MoneyRequestDtls mrd = new B_FIM_MoneyRequestDtls();
       //IBLL_FIM_MAS_BorrowTypes bt = new B_FIM_MAS_BorrowTypes();
       //IBLL_BGM_MAS_Source source = new B_BGM_MAS_Source();
       // B_MessageSend send = new B_MessageSend();
       // IBLL_FIM_MAS_Contacts con = new B_FIM_MAS_Contacts();
       // IBLL_BGM_MAS_ExpenseGroup expgrp = new B_BGM_MAS_ExpenseGroup();
       // IBLL_FIM_MoneyReturns re = new B_FIM_MoneyReturns();
       // IBLL_FIM_MoneyReturnDtls red = new B_FIM_MoneyReturnDtls();

        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
   
                PanelView.Visible = true;
                var data = mr.GetFull(null, null, null, "16", null, null, "A", false);
                grdHistory.DataSource = data;
                grdHistory.DataBind();
            }
        }
        protected void LoadData()
        {
            DateTime? dFromDate = txtFromDate.GetDateValue();
            DateTime? dToDate = txtToDate.GetDateValue();

            //grdHistory.DataSource = bankAcc.GetBankAccountHistory(lblBankAccSeq.Text, dFromDate, dToDate);
            var data = mr.GetFull(null, null, null, "16", null, null, "A", false);
            grdHistory.DataSource = data;
            grdHistory.DataBind();
        }

        protected void LoadDataSort()
        {
            DateTime? dFromDate = txtFromDate.GetDateValue();
            DateTime? dToDate = txtToDate.GetDateValue();

            //grdHistory.DataSource = bankAcc.GetBankAccountHistory(lblBankAccSeq.Text, dFromDate, dToDate);
            //var data = mr.GetFull(null, null, null, "16", null, null, "A", false);
            var data = mr.GetReturnDate(null, null, null, "16", null, null, "A",dFromDate,dToDate, false);
            grdHistory.DataSource = data;
            grdHistory.DataBind();
        }

        protected void cmdFilter_Click(object sender, EventArgs e)
        {
            LoadDataSort();
        }

        protected void grdHistory_ItemCommand(object sender, GridCommandEventArgs e)
        {
            LoadData();
        }
    }
}